package com.yugao.fintech.antelope.pay.payment.controller.refund;

import com.yugao.fintech.antelope.base.log.OperateLog;
import com.yugao.fintech.antelope.pay.common.annotation.PayCheck;
import com.yugao.fintech.antelope.pay.model.rqrs.pay.refund.RefundOrderRQ;
import com.yugao.fintech.antelope.pay.payment.process.refund.RefundOrderProcess;
import com.yugao.fintech.antelope.pay.validation.PaySignGroup;
import com.yugao.fintech.framework.core.response.Resp;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商户发起退款 controller
 */
@Slf4j
@RestController
@RequestMapping("/pay/refund")
public class RefundOrderController {
    @Autowired
    private RefundOrderProcess refundOrderProcess;

    /**
     * 申请退款
     */
    @OperateLog(isSaveDb = false)
    @PostMapping("/refundOrder")
    @PayCheck
    public Resp<?> refundOrder(@RequestBody @Validated(value = PaySignGroup.class) RefundOrderRQ rq) {
        return refundOrderProcess.refundOrder(rq);
    }

}
